package com.hnevc.musicsystem;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;

public class MusicSystem {
	public ArrayList<Music> musicList;
	
	public void shiftTop(Music music){
		musicList.remove(music);
		musicList.add(0, music);
	}
	public void playTop(){
		musicList.get(0).play();
	}
	public void showMusic(){
		Iterator<Music>it=musicList.iterator();
		while(it.hasNext()){
			Music music=it.next();
			System.out.println(music.name);
		}
	}
	public void orderBySinger(){
	Collections.sort(musicList, new Comparator<Music>(){
		public int compare(Music o1, Music o2) {
		return o1.singer.compareTo(o2.singer);
	}
	});

}

public void shifBottom(Music music){
	musicList.remove(music);
	musicList.add(music);
}
	}

